<?php

/**
 * @author Charles EDOU NZE <charlesen@live.fr>
 * @copyright Copyright 2011, Charles EDOU NZE - http://www.charlesen.fr
 * @version 1.0
 *
 * Classes utilitaires
 */
require_once 'configuration.php';

class Connexion {

    /**
     *
     * @param String $login
     * @param String $mdp
     * @return boolean
     */
    function doConnect($login, $mdp) {
        $connected = false;
        $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD)
                or die("Impossible de se connecter : " . mysql_error());
        mysql_select_db(DB_NAME, $link)
                or die('Impossible de selectionner la table. Contactez un administrateur.');

        $requete = "SELECT * FROM clients WHERE login =" . $login . " AND mdp=" . $mdp;
        $result = mysql_query($requete, $link);
        mysql_close($link);

        if (!$result) {
            $connected = true; // On renvoie "true" en cas d'authentification réussie
        }
        return $connected;
    }
}

?>
